
package com.welsy.user.business
{
	import mx.rpc.Fault;
	import mx.rpc.events.FaultEvent;
	import mx.rpc.events.ResultEvent;
	import mx.rpc.soap.mxml.WebService;	
	import mx.rpc.AbstractOperation;
	import com.adobe.cairngorm.business.ServiceLocator;
	import mx.rpc.IResponder;
	import mx.rpc.AsyncToken;
	import flash.utils.setTimeout;	
	import com.welsy.authoring.vo.CourseVO;
	import mx.collections.XMLListCollection;
	import com.welsy.authoring.vo.CourseComponentsVO;
	import com.welsy.user.model.UserModelLocator;		

	/**
	 * @version	$Revision: 1.1 $
	 */
	public class SaveQuestionTrackDelegate
	{
		public function SaveQuestionTrackDelegate( responder : IResponder )
		{		
			this.service = ServiceLocator.getInstance().getWebService("TrackService") as WebService;
			var o:AbstractOperation = service.getOperation("SaveTrackQuestion");
			//o.addEventListener(ResultEvent.RESULT, GetCourseComponents_onResult);
			this.responder = responder;
		}
										
		public function saveTrack(questionId:String,status:String,isLast:Boolean) : void
		{						
			var o:AbstractOperation = service.getOperation("SaveTrackQuestion");
			o.arguments.TrackQuestionRequest.Id = questionId;
			o.arguments.TrackQuestionRequest.UserId = UserModelLocator.getInstance().user.UserId;
			o.arguments.TrackQuestionRequest.Status = status;
			o.arguments.TrackQuestionRequest.IsLast = isLast;
			
			var token:AsyncToken = service.SaveTrackQuestion();
			// notify this command when the service call completes
			token.addResponder( responder );
		}	
		
		private var responder : IResponder;
		private var service : Object;
	}

}